package com.weayer.controller;

import com.weayer.dto.ResponseResult;
import com.weayer.request.ForecastPriceDTO;
import com.weayer.service.ForecastPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: Api服务 - 乘客 - 计价controller
 * @author: Weayer
 **/
@RestController
public class ForecastPriceController {
    @Autowired
    ForecastPriceService forecastPriceService;

    /**
     * @Description: 预估价格
     * @Param: [forecastPriceDTO]
     * @return: com.weayer.dto.ResponseResult
     **/
    @PostMapping("/forecast-price")
    public ResponseResult forecastPrice(@Validated @RequestBody ForecastPriceDTO forecastPriceDTO){
        String depLongitude = forecastPriceDTO.getDepLongitude();
        String depLatitude = forecastPriceDTO.getDepLatitude();
        String desLongitude = forecastPriceDTO.getDesLongitude();
        String desLatitude = forecastPriceDTO.getDesLatitude();
        String cityCode = forecastPriceDTO.getCityCode();
        String vehicleType = forecastPriceDTO.getVehicleType();
        return forecastPriceService.forecastPrice(depLongitude, depLatitude, desLongitude, desLatitude, cityCode, vehicleType);
    }
}
